home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
A.C.E. 2
/
ACE CD 2.iso
/
FILES
/
UTILS
/
AMOSPRO3.DMS
/
AMOSPRO3.adf
/
Resource_Bank_Maker.AMOS
/
Resource_Bank_Maker.amosSourceCode
Wrap
AMOS Source Code
|
1993-03-16
|
28KB
|
1,092 lines
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'
' AMOSPro Resource Bank Maker V1.1
'
'
' Default bank number is 16. Change the "BK" variable for another bank
' Maximum bank size is in variable "BMAX"
'
' By Fran�ois Lionet
'
' (c) 1992 Europress Software Ltd.
'
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Set Buffer 32
VER$="1.1"
Global DB$,VER$
Global YDI,QUIT
Global BNAME$
Global PUMX,NPU,CPU,PNAME$,PULAST,PUPICS
Global STMX,NST
Global MX,MY,MK,MZ,MS
Global BXOLD,BXINK,FL
Global BXX,BXY,BXSX,BXSY
Global BKPOS,BKCHANGE,BK,TBNK,BKCHUNKS,BGRB,BMAX
' Maximum number of graphic elements
PUMX=256
Dim PUX(PUMX),PUY(PUMX),PUSX(PUMX),PUSY(PUMX),PU$(PUMX),PUN(PUMX)
Global PUX(),PUY(),PUSX(),PUSY(),PU$(),PUN()
' Maximum number of strings
STMX=256
Dim ST$(STMX)
Global ST$()
' Default bank number
BK=16
' Maximum bank size (in K)
BMAX=64
' Temporary bank
TBNK=BK+2
C$=Command Line$
' Memory check
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If Chip Free+Fast Free<(BMAX+32)*1024 : LOWMEM : End If
' Initialisation
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Erase All
INIT_SCREEN
BANK_NEW
If C$="GRAB" : MN_GRAB : End If
MN_MAIN[C$]
' Main Menu
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Procedure MN_MAIN[C$]
Do
If BGRB
A$="-GRABBED- "
Else
A$=""
End If
If BNAME$=""
Vdialog$(1,0)=A$+"Unnamed"
Else
Vdialog$(1,0)=A$+Right$(BNAME$,24-Len(A$))
End If
D=Dialog Run(1,1)
If C$="DEFAULT_RESOURCE"
MN_AUTOMATIC[Resource$(0)+"AMOSPro.Default_Resource"]
End If
If C$="EDITOR_RESOURCE"
MN_AUTOMATIC[Resource$(0)+"AMOSPro.Editor_Resource"]
End If
If C$="MONITOR_RESOURCE"
MN_AUTOMATIC[Resource$(0)+"AMOSPro.Monitor_Resource"]
End If
Repeat
Multi Wait
D=Dialog(1)
On D Proc MN_QUIT,MN_QUIT,MN_NEW,MN_LOAD,MN_SAVE,MN_SAVEAS,MN_GRAPHIC,MN_STRING,MN_GRAB
OLDD=D
Until QUIT
QUIT=0
Loop
End Proc
Procedure MN_QUIT
' Quit the program
D=2
If BKCHANGE
D=Dialog Box(DB$,1,"Quit resource bank maker. Sure?")
End If
If D=2
If BGRB
D=Dialog Box(DB$,1,"Copy resource bank to previous program?")
If D=2
BNK_CREATE
If Param>=0
Bsend BK
Else
D=Dialog Box(DB$,2,"Out of memory, cannot grab bank!")
Pop Proc
End If
Else
D=Dialog Box(DB$,1,"Your bank will be lost if you quit. Quit anyway?")
If D<>2 : Pop Proc : End If
End If
End If
Dialog Close 1
Screen Close 0 : If PNAME$<>"" : Screen Close 1 : End If
Erase BK : Edit
End If
End Proc
Procedure MN_NEW
' Create a new bank
D=2
If BKCHANGE
D=Dialog Box(DB$,1,"Create a new bank, and loose current?")
End If
If D=2 : BANK_NEW : QUIT=-1 : End If
End Proc
Procedure MN_LOAD
Dialog Freeze
D=2
If BKCHANGE
D=Dialog Box(DB$,1,"Load a new bank, and loose current?")
End If
If D=2
BANK_NEW : QUIT=-1
F$=Fsel$("*.Abk","","Please choose resource bank.")
If F$="" : Pop Proc : End If
Trap Load F$,BK
If Errtrap=0
A$="" : If Length(BK) : A$=Peek$(Start(BK)-8,8) : End If
If A$<>"Resource"
D=Dialog Box(DB$,2,"This bank is not a resource bank.")
Else
BNK_DIGEST[Start(BK)]
If Param : BNAME$=F$ : End If
End If
Else
D=Dialog Box(DB$,2,"Disc error: could not load bank.")
End If
If BGRB : BKCHANGE=1 : End If
End If
Erase BK : Dialog Unfreeze : QUIT=-1
End Proc
Procedure BNK_DIGEST[AB]
Do
BKCHUNKS=Deek(AB) : DD=2 : If BKCHUNKS=0 : BKCHUNKS=2 : DD=0 : End If
' Grab the graphic data
AG=Leek(AB+DD)
If AG
AG=AB+AG : NP=Deek(AG) : AP=AG+2+NP*4
Add AP,4+32*2 : L=Deek(AP) : PNAME$=Peek$(AP+2,L)
P=0 : CPOS=0
Repeat
A=Leek(AG+P*4+2)
If A
AP=AG+A
PUX(CPOS)=Deek(AP+4)*8 : PUY(CPOS)=Deek(AP+6)
PUSX(CPOS)=Deek(AP+8)*8 : PUSY(CPOS)=Deek(AP+10)*Deek(AP+12)
PUN(CPOS)=1
If Deek(AP-2)=$ABCD
T=Peek(AP-3) : K=Peek(AP-4) : PUN(CPOS)=T
If T=3
If K=0 : PUSX(CPOS)=PUSX(CPOS)*3 : End If
If K=1 : PUSY(CPOS)=PUSY(CPOS)*3 : PUN(CPOS)=-PUN(CPOS) : End If
Add P,2
End If
If T=9 : PUSX(CPOS)=PUSX(CPOS)*3 : PUSY(CPOS)=PUSY(CPOS)*3 : Add P,8 : End If
End If
End If
Inc CPOS : Inc P
Until P>=NP
End If
' Grab the strings
A=Leek(AB+4+DD)
If A
AP=AB+A : ST=0
For ST=0 To STMX
L=Peek(AP+1) : Exit If L=$FF
ST$(ST)=Peek$(AP+2,L)
AP=AP+2+L
Next
End If
' Keep the other data zones in safe places
If BKCHUNKS>2
For B=2 To BKCHUNKS-1
A=Leek(AB+DD+B*4)
If A
AP=AB+A
L=Leek(AB+DD+BKCHUNKS*4+B*4)
Reserve As Work TBNK+B,L
Copy AP,AP+L To Start(TBNK+B)
End If
Next
End If
' Load the picture
If PNAME$<>""
Repeat
Trap Load Iff PNAME$,1
If Errtrap
PNAME$=Fsel$("*.Iff","","Can't load the default picture","Please enter correct pathname")
If PNAME$=""
BANK_NEW
D=Dialog Box(DB$,2,"Sorry, load aborted!")
Exit 2
End If
End If
Until Errtrap=0
Screen To Back 1 : Screen 0
End If
F=-1 : Exit
Loop
End Proc[F]
Procedure MN_SAVE
Dialog Freeze
BNK_CREATE
If Param>0
If BNAME$=""
F$=Fsel$("*.Abk","","Please choose a name.","The name should finish by '.Abk'")
If F$="" : Goto _END : End If
BNAME$=F$
End If
If BNAME$<>""
Trap Save BNAME$,BK
If Errtrap=0
BKCHANGE=0
Else
D=Dialog Box(DB$,2,"Disc error: could not save bank.")
End If
End If
Else If Param=0
D=Dialog Box(DB$,2,"Nothing to save!")
Else
D=Dialog Box(DB$,2,"Out of memory!")
End If
_END: Erase BK : Dialog Unfreeze : QUIT=-1 : Pop Proc
End Proc
Procedure BNK_CREATE
LMAX=BMAX*1024+Length(TBNK)+Length(TBNK+1)
Reserve As Data BK,LMAX
' Header
Poke$ Start(BK)-8,"Resource"
AB=Start(BK) : EB=Start(BK)+LMAX
AL=AB+2+BKCHUNKS*4 : AP=AL+BKCHUNKS*4
Doke AB,BKCHUNKS
' Grab the graphic part
PU_ARRAY
If PULAST>=0
Screen Hide 0
AG=AP : Loke AB+2,AG-AB
Doke AG,PUPICS : AP=AG+2+PUPICS*4
Screen 1
Doke AP,Screen Colour : Doke AP+2,Deek(Screen Base+72) : Add AP,4
For C=0 To 31 : Doke AP,Colour(C) : Add AP,2 : Next
Doke AP,Len(PNAME$) : Poke$ AP+2,PNAME$
AP=AP+Len(PNAME$)+2 : AP=AP+AP mod 2
PN=0
For P=0 To PULAST
If PUN(P)
If PUN(P)>0 : Poke AP,0 : Poke AP+1,PUN(P) : End If
If PUN(P)<0 : Poke AP,1 : Poke AP+1,-PUN(P) : End If
Doke AP+2,$ABCD : Add AP,4
If PUN(P)=1
X=PUX(P) : Y=PUY(P) : SX=PUSX(P) : SY=PUSY(P) : Gosub BK_GRAB
Else If PUN(P)=3
SX=PUSX(P)/3 : Y=PUY(P) : SY=PUSY(P)
For XX=0 To 2 : X=PUX(P)+XX*SX : Gosub BK_GRAB : Next
Else If PUN(P)=-3
SY=PUSY(P)/3 : X=PUX(P) : SX=PUSX(P)
For YY=0 To 2 : Y=PUY(P)+YY*SY : Gosub BK_GRAB : Next
Else If PUN(P)=9
SX=PUSX(P)/3 : SY=PUSY(P)/3 : N=0
For YY=0 To 2 : For XX=0 To 2
X=PUX(P)+XX*SX : Y=PUY(P)+YY*SY : Gosub BK_GRAB
Next : Next
End If
End If
Next
Loke AL,AP-AG
Screen Show 0 : Screen 0
End If
' Grab the text part
For S=0 To STMX
If Len(ST$(S))
SM=S : Add LS,Len(ST$(S))
End If
Next
If LS
AG=AP : Loke AB+2+4,AP-AB
For S=0 To SM
Poke AP,0
Poke AP+1,Len(ST$(S))
Poke$ AP+2,ST$(S)
Add AP,2+Len(ST$(S))
Next
Poke AP,0 : Poke AP+1,$FF : Add AP,2
Add AP,AP mod 2
Loke AL+4,AP-AG
End If
' Restore the data zones
If BKCHUNKS>2
For B=2 To BKCHUNKS-1
If Length(TBNK+B)
Loke AB+2+B*4,AP-AB
Loke AL+B*4,Length(TBNK+B)
Copy Start(TBNK+B),Start(TBNK+B)+Length(TBNK+B) To AP
Add AP,Length(TBNK+B)
Add AP,AP mod 2
Else
Loke AB+2+B*4,0 : Loke AL+B*4,0
End If
Next
End If
' Schink to the correct size
L=AP-Start(BK) : Bank Shrink BK To L
Screen Show 0 : Screen 0
Pop Proc[L]
BK_GRAB:
_BOX[X,Y,X+SX,Y+SY] : Wait 2 : _BOX[0,0,0,0]
Loke AG+2+PN*4,AP-AG
Pack 1 To BK+1,X,Y,X+SX,Y+SY
If AP+Length(BK+1)>=EB : Stop : End If
Copy Start(BK+1),Start(BK+1)+Length(BK+1) To AP
AP=AP+Length(BK+1) : AP=(AP+1) and $FFFFFFFE
Erase BK+1
Inc PN : Return
End Proc[L]
Procedure MN_SAVEAS
N$=BNAME$ : BNAME$=""
MN_SAVE
If BNAME$="" : BNAME$=N$ : End If
QUIT=-1
End Proc
Procedure MN_GRAB
Dialog Freeze
If Prg Under
D=2
If BKCHANGE
D=Dialog Box(DB$,1,"Grab a new bank, and loose current?")
End If
If D=2
BANK_NEW : BGRB=-1
If Blength(BK)
If Peek$(Bstart(BK)-8,8)="Resource"
BNK_DIGEST[Bstart(BK)]
End If
End If
If BGRB=0 : D=Dialog Box(DB$,2,"No bank to grab!") : End If
End If
End If
Dialog Unfreeze : QUIT=-1
End Proc
Procedure MN_AUTOMATIC[F$]
Trap Load F$,BK
D=Dialog Box(DB$,1,"Update of "+F$+"?")
If D=2
If Errtrap=0
BNK_DIGEST[Start(BK)]
If Param
BNAME$=F$
BNK_CREATE
If Param>0
Save BNAME$,BK
Else If Param=0
D=Dialog Box(DB$,2,"Nothing to save!")
Else
D=Dialog Box(DB$,2,"Out of memory!")
End If
End If
Else
D=Dialog Box(DB$,2,"Cannot load resource bank!")
End If
End If
BANK_NEW : BGRB=0 : MN_QUIT
End Proc
' String Edition
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Procedure MN_STRING
POS=0
Do
Vdialog(1,3)=Array(ST$(0))
Vdialog(1,4)=POS
D=Dialog Run(1,2)
Do
Multi Wait
D=Dialog(1) : Exit If D=1,2
POS=Vdialog(1,4)
If D=6
MN_PRINT : Exit
End If
If D=5
A=Dialog Box(DB$,1,"Erase all strings, sure?")
If A=2 : For S=0 To STMX : ST$(S)="" : Next : Exit : End If
End If
If D=4
MN_EDIT[Rdialog(1,4)] : Exit
End If
OLDD=D
Loop
Loop
QUIT=1
End Proc
Procedure MN_EDIT[ST]
Vdialog(1,0)=ST
Vdialog$(1,1)=ST$(ST)
D=Dialog Run(1,3)
A$=Rdialog$(1,10)
If D=2 : ST$(ST)=Rdialog$(1,10) : End If
If D=3
If ST<STMX
For S=STMX-1 To ST Step -1
ST$(S+1)=ST$(S)
Next
End If
ST$(ST)=Rdialog$(1,10)
End If
If D=4
If ST<STMX
For S=ST To STMX-1
ST$(S)=ST$(S+1)
Next
End If
ST$(STMX)=""
End If
Inc BKCHANGE
End Proc
Procedure BANK_NEW
' Erase the current bank from memory
BNAME$=""
For S=0 To STMX : ST$(S)="" : Next
For P=0 To PUMX : PU$(P)="" : PUN(P)=0 : Next
If PNAME$<>"" : PNAME$="" : Screen Close 1 : End If
BKCHANGE=0 : BKCHUNKS=2
Erase TBNK : Erase TBNK+1
End Proc
' Graphic Element
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Procedure MN_GRAPHIC
If PNAME$=""
MN_GLOAD
If PNAME$="" : QUIT=-1 : Pop Proc : End If
End If
CPU=0
Vdialog(1,11)=Array(PU$(0))
Vdialog(1,12)=0
D=Dialog Run(1,4)
Do
PU_ARRAY
Dialog Update 1,12,,CPU,PULAST+2
Repeat
Multi Wait
' Flash the current element
CPU=Rdialog(1,12)
If CPU>=0
If PUX(CPU)>=0
Add FL,1,0 To 10
If FL=1
_BOX[PUX(CPU),PUY(CPU),PUX(CPU)+PUSX(CPU),PUY(CPU)+PUSY(CPU)]
End If
If FL=5 : _BOX[0,0,0,0] : End If
End If
End If
D=Dialog(1) : Exit If D=1,2
If D : _BOX[0,0,0,0] : End If
On D-1 Proc MN_QUIT,MN_GLOAD,MN_GELEMENT,MN_GHLINE,MN_GBOX,MN_GDEL,MN_GCLEAR,MN_GVLINE
OLDD=D
Until QUIT
QUIT=0
Loop
QUIT=1
End Proc
Procedure MN_GLOAD
F$=Fsel$("**","","Please choose an IFF picture")
If F$<>""
Load Iff F$,1 : Screen To Front 0 : Screen 0
PNAME$=F$
Inc BKCHANGE
End If
End Proc
Procedure MN_GDEL
MN_GSELECT
If Param
If CPU<=PULAST
For P=CPU To PUMX-1
PUX(P)=PUX(P+1) : PUY(P)=PUY(P+1)
PUSX(P)=PUSX(P+1) : PUSY(P)=PUSY(P+1)
PUN(P)=PUN(P+1) : PU$(P)=PU$(P+1)
Next
PUN(PUMX)=0
Inc BKCHANGE
End If
End If
QUIT=-1
End Proc
Procedure MN_GELEMENT
MN_GGRAB[1]
End Proc
Procedure MN_GHLINE
MN_GGRAB[3]
End Proc
Procedure MN_GVLINE
MN_GGRAB[-3]
End Proc
Procedure MN_GBOX
MN_GGRAB[9]
End Proc
Procedure MN_GGRAB[T]
MN_GPIC
If Param
MN_GSELECT
If Param
Dialog Freeze
Screen Hide 0 : _GRABIT[T]
Screen Show 0 : Screen To Front 0 : Screen 0
If Param
If CPU<PUMX
If CPU<=PULAST
For P=PUMX To CPU+1 Step -1
PUX(P)=PUX(P-1) : PUY(P)=PUY(P-1)
PUSX(P)=PUSX(P-1) : PUSY(P)=PUSY(P-1)
PUN(P)=PUN(P-1) : PU$(P)=PU$(P-1)
Next
End If
End If
PUX(CPU)=BXX : PUY(CPU)=BXY
PUSX(CPU)=BXSX : PUSY(CPU)=BXSY
PUN(CPU)=T
QUIT=-1
Inc BKCHANGE
End If
Dialog Unfreeze
End If
End If
End Proc
Procedure PU_ARRAY
For P=0 To PUMX : PU$(P)="" : Next
PUPICS=1 : PULAST=-1
For P=0 To PUMX
If PUN(P)
A$=Str$(PUPICS) : PU$(P)=A$+Space$(4-Len(A$))
If PUN(P)=1 : A$=" - Element:" : End If
If PUN(P)=3 : A$=" - H. Line:" : End If
If PUN(P)=-3 : A$=" - V. Line:" : End If
If PUN(P)=9 : A$=" - Box :" : End If
PU$(P)=PU$(P)+A$+Str$(PUSX(P))+" x"+Str$(PUSY(P))
Add PUPICS,Abs(PUN(P))
PULAST=P
End If
Next
A$=Str$(PUPICS) : PU$(PULAST+1)=A$+Space$(4-Len(A$))+" - New Element"
Dec PUPICS
End Proc
Procedure MN_GCLEAR
D=2
If PULAST>=0
D=Dialog Box(DB$,1,"Clear all graphic elements, sure?")
End If
If D=2
NPU=0
For N=0 To PUMX
PU$(N)="" : PUN(N)=0
Next
P=-1
End If
QUIT=-1
Inc BKCHANGE
End Proc[P]
Procedure MN_GSELECT
P=-1
If CPU<0
D=Dialog Box(DB$,2,"You must select an element in the list first!")
P=0
End If
End Proc[P]
Procedure MN_GPIC
P=-1
If PNAME$=""
D=Dialog Box(DB$,2,"You must load a picture first!")
P=0
End If
End Proc[P]
Procedure _GRABIT[T]
' Prepare screen 1
Screen 1 : Clip
Gr Writing 2 : PDR=1 : O=0 : OMX=-1
Set Pattern 0 : Set Paint 0
_BOX[0,0,0,0]
' Open small info screen
Screen Open 2,640,8,2,Hires
Curs Off : Palette $55A,$FFF : Screen Display 2,,320,,
If T=1 : T$=" Grabbing a simple element" : End If
If T=3 : T$=" Grabbing an horizontal line" : End If
If T=-3 : T$=" Grabbing a vertical line" : End If
If T=9 : T$=" Grabbing a box" : End If
' Main loop
Repeat
Screen 1 : _MOUSE
MX=(MX+3) and $FFFFFFF8
If Inkey$=" " : Add BXINK,1,0 To Screen Colour : End If
' Change the position of the info screen
If MY>150
Screen Display 2,,45,,
Else
Screen Display 2,,245,,
End If
' Call the proper display routine
If MS=1
If MX<>OMX or MY<>OMY or MK<>OMK
On PDR Gosub GB1,GB2,GB3
OMX=MX : OMY=MY : OMK=MK
End If
End If
' Wait for the end
Until PDR=0 or PDR=4
' Something to erase?
_BOX[0,0,0,0]
' Close the info screen
Screen Close 2 : F=0
If PDR=4
BXX=X1 : BXY=Y1 : BXSX=SX : BXSY=SY
F=-1
End If
Repeat : _MOUSE : Until MK=0
Goto _END
' Step 1 : set the beginning of the box
GB1:
X1=MX : Y1=MY : X2=X1 : Y2=Y1
Screen 2 : Centre T$+" - X:"+Str$(X1)+" - Y:"+Str$(Y1)+" "
If MK=1 : PDR=2 : End If
If MK=2 : PDR=0 : End If
Return
' Step 2 : open the box
GB2:
If MX>X1 and MY>Y1
If T=1
X2=MX : Y2=MY : _BOX[X1,Y1,X2,Y2]
End If
If T=3
If MX-X1>=24
X2=X1+((MX-X1)/24)*24 : Y2=MY
_BOX[X1,Y1,X2,Y2]
End If
End If
If T=-3
If MY-Y1>=3
Y2=Y1+((MY-Y1)/3)*3 : X2=MX
_BOX[X1,Y1,X2,Y2]
End If
End If
If T=9
If MX-X1>=24 and MY-Y1>3
X2=X1+((MX-X1)/24)*24 : Y2=Y1+((MY-Y1)/3)*3
_BOX[X1,Y1,X2,Y2]
End If
End If
End If
Screen 2
Centre T$+" - X:"+Str$(X1)+" - Y:"+Str$(Y1)+" / SX:"+Str$(X2-X1)+" - SY:"+Str$(Y2-Y1)+" "
If MK=0
PDR=3 : SX=X2-X1 : SY=Y2-Y1
End If
Return
'
' Etape 3 : positionnement de la boite
GB3:
X2=MX : Y2=MY : X1=MX-SX : Y1=MY-SY
If X1<0 : X1=0 : X2=SX : End If
If Y1<0 : Y1=0 : Y2=SY : End If
_BOX[X1,Y1,X2,Y2]
Screen 2
Centre T$+" - X:"+Str$(X1)+" - Y:"+Str$(Y1)+" / SX:"+Str$(SX)+" - SY:"+Str$(SY)+" "
If MK=1 : PDR=4 : End If
If MK=2
PDR=1 : Cls : _BOX[0,0,0,0]
While Mouse Key : Wend
End If
Return
'
_END:
End Proc[F]
Procedure _BOX[X1,Y1,X2,Y2]
' Draw the box
S=Screen : Screen 1
If BXOLD : Put Block 2 : Del Block 2 : BXOLD=0 : End If
If X2>X1+1 and Y2>Y1+1
X=X1 and $FFFFFFF0
XX=Min(Screen Width,(X2+16) and $FFFFFFF0)
Gr Writing 0 : Set Pattern 2 : Set Paint 1 : Ink BXINK,BXINK,BXINK
Get Block 2,X,Y1,XX-X,Y2-Y1+1
Bar X1,Y1 To X2-1,Y2-1 : BXOLD=-1
End If
Screen S
End Proc
Procedure _MOUSE
' Mouse input
Multi Wait
MX=X Screen(X Mouse) : MY=Y Screen(Y Mouse)
MZ=Mouse Zone : MK=Mouse Key : MS=Mouse Screen
End Proc
Procedure INIT_SCREEN
Restore DBL
Repeat
Read A$ : DB$=DB$+A$
Until A$=""
ESX=640 : ESY=88 : YDI=150
Screen Open 0,ESX,ESY,8,Hires
Screen Display 0,,YDI,,
Curs Off : Flash Off : Cls 0
GRB_EDITOR_PALETTE
Paper 0 : Pen 1
Limit Mouse 96,35 To 530,312
On Error Goto ERR
Dialog Open 1,DB$,32
Pop Proc
ERR: Print Mid$(DB$,Edialog,80) : Wait Key : End
' Definition of quick-run dialog boxes
DBL:
Data "SVar 2,'Ok';"
Data "SVar 3,'Cancel';"
Data "SIze 1VA TW 160+,64;"
Data "BAse SWidth SX -2/,SHeight SY- 2/;"
Data "IF 0VA 0\; [SAve 1;]"
Data "RBox 0,0,SX,SY,0;"
Data "CTxt 16,8,SX 16-,32,1,1VA;"
Data "IF 0VA 1=;"
Data "["
Data " BJ 1,16,SY 24-,64,16,3VA; KY 27,0;"
Data " BJ 2,SX 80-,SY 24-,64,16,2VA; KY 13,0;"
Data " RUn 0,3;"
Data "]"
Data "IF 0VA 2=;"
Data "["
Data " BJ 1,SX 80-,SY 24-,64,16,3VA; KY $FF,0;"
Data " RUn 0,3;"
Data "]"
Data "EXit;"
' Definition of the first menu page
Data "LA 1;"
Data "SVar 0,'Resource Bank Creator V"+VER$+" - Current bank : ' 0VA !;"
Data "SVar 1,'Quit';"
Data "SVar 2,'Create a new bank';"
Data "SVar 3,'Load a bank';"
Data "SVar 4,'Save Bank';"
Data "SVar 5,'Save Bank As';"
Data "SVar 6,'Edit Graphic Elements';"
Data "SVar 7,'Edit Text Strings';"
Data "SVar 8,'Grab Previous Bank';"
Data "BAse 0,0; SIze SW,SH;"
Data "BT 1,0,0,48,16,1VA;"
Data "BI 0,XB,0,SX XB-,16,0VA;"
Data "RB 0,16,SX,SY,0;"
Data "BT 3,32,28,256,12,2VA;"
Data "BT 4,XA,YB,XB XA-,YB YA-,3VA;"
Data "BT 9,32,YB,256,YBYA-,8VA;"
Data "BT 5,XA,YB,XB XA-2/,YB YA-,4VA;"
Data "BT 6,XB,YA,XB XA-,YB YA-,5VA;"
Data "BT 7,352,28,256,24,6VA;"
Data "BT 8,XA,YB,XB XA-,YB YA-,7VA;"
Data "EXit;"
' Definition of the text menu page
Data "LA 2;"
Data "SVar 0,'AMOS Resource Bank Creator - String edition';"
Data "SVar 1,'Exit';"
Data "SVar 2,'Clear';"
Data "SVar 6,'Print';"
Data "BAse 0,0; SIze SW,SH;"
Data "BT 1,0,0,48,16,1VA;"
Data "BI 0,XB,0,SX XB-,16,0VA;"
Data "RB 0,16,SX,SY,0;"
Data "LS 3,14,22,SX78-2+,SY6-,%11;"
Data "BV 6,XB,YA,32,YB YA-,6VA;"
Data "BV 5,XB,YA,32,YB YA-,2VA;"
Data "EXit;"
' Definition of the pop-up string edition
Data "LA 3;"
Data "SVar 2,'String number ' 0VA 1+ # !;"
Data "SVar 3,'[Esc] Cancel';"
Data "SVar 4,'[Ret] Replace';"
Data "SVar 5,'[F1] Insert';"
Data "SVar 6,'[Del] Delete';"
Data "BAse 16,8; SIze SW32-,SH16-;SA 1;"
Data "RBox 0,0,SX,SY,0;"
Data "RBox 8,4,SX8-,20,1;"
Data "POut 2VA CX,8,2VA,0,3;"
Data "RBox 13,30,SX 13-,42,1;"
Data "EDit 10,16,32,72,250,1VA,0,3;"
Data "BJ 1,SX 144-,SY 24-,128,16,3VA; KY 27,0;"
Data "BJ 2,16,SY 24-,128,16,4VA; KY 13,0;"
Data "BJ 3,XB,YA,XB XA-,YB YA-,5VA; KY $D0,0;"
Data "BJ 4,XB,YA,XB XA-,YB YA-,6VA; KY $C6,0;"
Data "RU 0,3;"
Data "EXit;"
' Definition of the graphic element menu
Data "LA 4;"
Data "SVar 0,'AMOS Resource Bank Creator - Graphic Elements Edition';"
Data "SVar 1,'Exit';"
Data "SVar 2,'Change Picture';"
Data "SVar 3,'Grab One Element';"
Data "SVar 4,'Grab Horiz. Line';"
Data "SVar 5,'Grab A Box';"
Data "SVar 6,'Del';"
Data "SVar 7,'Clear';"
Data "SVar 8,'Grab Vert. Line';"
Data "BAse 0,0; SIze SW,SH;"
Data "BT 1,0,0,48,16,1VA;"
Data "BI 0,XB,0,SX XB-,16,0VA;"
Data "RB 0,16,SX,SY,0;"
Data "BT 3,14,22,128,SY28-,2VA;"
Data "BT 4,XB 16+,YA,160,15,3VA;"
Data "BT 5,XA,YB,XB XA-,YB YA-,4VA;"
Data "BT 9,XA,YB,XB XA-,YB YA-,8VA;"
Data "BT 6,XA,YB,XB XA-,YB YA-,5VA;"
Data "LS 11,XB 16+,22,SX77-,SY6-,%100;"
Data "BV 7,XB,22,32,YB22-,6VA;"
Data "BV 8,XB,22,32,YB22-,7VA;"
Data "EXit;"
' --------------------------------
' List Slider: draw a list + a slider, linked together
' LS zone,x,y,x,y,flags
Data "UI LS,6; ["
Data "RB P2,P3,P2 16+,P5,1;"
Data "RB XB,YA,P4,P5,1;"
Data "SZone P1;"
Data "VSlide P1,P2 3+,P3 2+,9,P5 P3- 4-,1P1+VA,7,256,1;[ZChange ZNum 1+,ZPos;SVar 1ZN+,ZPos;]"
Data "AList P1 1+,P2 18+,P3 2+,P4 P2- 18- 8/,P5 P3- 8/,P1 VA,1P1+VA,P6,0,3;[]"
Data "XY P2,P3,P4,P5;]"
'----------------------------------------
' One button, with vertical text, click only
' BV zone,x,y,sx,sy,text
Data "UI BV,6; ["
Data "SZone P6;"
Data "BU P1,P2,P3,P4,P5,0,0,1;"
Data " [RB 0,0,SX,SY,BP;"
Data " VTxt SX 2/ 4- BP+,SY ZVarTLen TH* - 2/ BP+,ZV,3;]"
Data " [BR 0;]"
Data "]"
'----------------------------------------
' One button, with text, click only
' BT zone,x,y,sx,sy,text
Data "UI BT,6; ["
Data "SZone P6;"
Data "BU P1,P2,P3,P4,P5,0,0,1;"
Data " [RB 0,0,SX,SY,BP;"
Data " PR ZV CX BP+,SY TH- 2/ BP+,ZV,3;]"
Data " [BR 0;]"
Data "]"
'----------------------------------------
' One button, with text to move the screen
' BT zone,x,y,sx,sy,text
Data "UI BI,6; ["
Data "SZone P6;"
Data "BU P1,P2,P3,P4,P5,0,0,1;"
Data " [RB 0,0,SX,SY,BP;"
Data " PR ZV CX BP+,SY TH- 2/ BP+,ZV,3;]"
Data " [SMove;BR 0;]"
Data "]"
'----------------------------------------
' One button, with text, click only, QUIT!
' BJ zone,x,y,sx,sy,text
Data "UI BJ,6; ["
Data "SZone P6;"
Data "BU P1,P2,P3,P4,P5,0,0,1;"
Data " [RB 0,0,SX,SY,BP;"
Data " PO ZV CX BP+,SY TH- 2/ BP+,ZV,0,3;]"
Data " [BR 0;BQuit;]"
Data "]"
'----------------------------------------
' Text centered in one RB
' CT x1,y1,x2,y2,act,text
Data "UI CT,6; ["
Data "RB P1,P2,P3,P4,P5;"
Data "PRint P3 P1- P6TW- 2/ P1+,P4 P2- TH- 2/ P2+,P6,3;"
Data "XY P1,P2,P3,P4;]"
'----------------------------------------
' Ronnies Simpson graphic box definition
' RB x1,y1,x2,y2,activated
Data "UI RB,5; [SWrite 1; SPattern 0,0;"
Data "IF P5 0=;["
Data "INk 0,0,0; GSquare P1,P2,P3 1-,P4 1-;"
Data "INk 6,6,6; GBox P1 1+,P2 1+,P3 2-,P4 2-; "
Data "INk 5,5,5; GLine P1 2+,P4 2-,P1 2+,P2 1+;"
Data " GLine P1 1+,P4 2-,P1 1+,P2 1+;"
Data " GLine P1 1+,P2 1+,P3 2-,P2 1+;"
Data "INk 2,2,2; GLine P1 2+,P4 2-,P3 2-,P4 2-;"
Data " GLine P3 3-,P2 2+,P3 3-,P4 2-;"
Data " GLine P3 2-,P2 1+,P3 2-,P4 2-;"
Data "INk 3,3,3; GLine P1 3+,P2 2+,P1 4+,P2 2+;]"
Data "IF P5 0\;["
Data "INk 0,0,0; GSquare P1,P2,P3 1-,P4 1-;"
Data "INk 2,2,2; GBox P1 1+,P2 1+,P3 2-,P4 2-; "
Data "INk 1,1,1; GLine P1 2+,P4 2-,P1 2+,P2 1+;"
Data " GLine P1 1+,P4 2-,P1 1+,P2 1+;"
Data " GLine P1 1+,P2 1+,P3 2-,P2 1+;"
Data "INk 5,5,5; GLine P1 2+,P4 2-,P3 2-,P4 2-;"
Data " GLine P3 3-,P2 2+,P3 3-,P4 2-;"
Data " GLine P3 2-,P2 1+,P3 2-,P4 2-;]"
Data "SWrite 0; XY P1,P2,P3,P4;]"
Data ""
End Proc
Procedure GRB_EDITOR_PALETTE
ADAT=Leek(Dreg(3))
If ADAT=0
Palette 0,$6F,$77,$EEE,$F00,$DD,$AA,$FF3
Else
For C=0 To 7
Colour C,Deek(ADAT+28+C*2)
Next
Colour 1,(Colour(2) and $EEE)/2
End If
End Proc
Procedure LOWMEM
Screen Open 0,640,8,2,Hires : Curs Off
Colour 1,$FFF
Centre "Memory too low. Press any key to abort."
Wait Key
Edit
End Proc
Procedure MN_PRINT
Dialog Freeze
For MS=STMX To 0 Step -1
Exit If ST$(MS)-" "<>""
Next
If MS>=0
X=Free
D=Dialog Box(DB$,1,"Print all strings: please check printer and click on [OK]") : If D<>2 : Pop Proc : End If
Do
Trap Printer Open
Exit If Errtrap=0
R=Dialog Box(DB$,1,"Printer not ready. Click on [Ok] to try again.")
If R<>2 : Pop Proc : End If
Loop
D=Dialog Box(DB$,0,"Printing resource strings.")
For S=0 To MS
If Printer Online=0
Repeat
R=Dialog Box(DB$,1,"Printer not ready. Click on [Ok] to try again.")
Exit If R<>2,2
Until Printer Online
End If
A$=Mid$(Str$(S),2)+"-"+ST$(S)
Trap Printer Send A$+Chr$(27)+"E"
Repeat : Exit If Inkey$<>"",2 : Multi Wait : Until Printer Check
Next
Repeat : Exit If Inkey$<>"" : Until Printer Check
Trap Printer Close
End If
Dialog Unfreeze
Pop Proc
End Proc